<template>
	<view class="container">
		<u-toast ref="uToast" />
		<u-navbar :is-back="true" :title="navigateTitle" back-icon-color='#333333' height="50" :border-bottom="false">
		</u-navbar>
		<view class="list">
			<view class="campus">
				<text>当前校区</text>
				<text>{{school.name}}</text>
			</view>
			<view class="research_name">
				<text>科组名称</text>
				<text>{{subject_name}}</text>
			</view>
			<!-- <view class="group_leader">
				<text>科组长</text>
				<text>唐少芬</text>
				<text>悠悠</text>
			</view> -->
			<view class="group_num">
				<text>科组人数</text>
				<text>{{teacher_count}}人</text>
			</view>
			<view class="" style="width:100%; height:25rpx;">
			</view>
		</view>
		<view class="teacher_list">
			<view class="teacher_info">
				<text>序号</text>
				<text>姓名</text>
				<text>电话</text>
				<text>性别</text>
				<text>年级</text>
				<text>学科</text>
			</view>
			<view class="per_teacher">
				<view class="" v-for="(item,index) in teacherLists" :key="index">
					<text class="num">{{index+1}}</text>
					<text class="name">{{item.full_name}}</text>
					<text class="phone">{{item.phone}}</text>
					<view class="sex">
						<text>{{$gender(item.gender,1)}}</text>
						<image :src="$gender(item.gender,2)" mode="widthFix"></image>
					</view>
					<text class="grade">初一年级</text>
					<text class="subject">{{subject_name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '../../request.js'
	export default {
		data() {
			return {
				navigateTitle: '',
				subjectId: '',
				school: {},
				subject_name: '',
				teacher_count: '',
				teacher_lists: [],
			}
		},
		onLoad(e) {
			if (e) {
				this.navigateTitle = `${e.id}组`;
				this.subjectId = e.subject_id;
			}
			this.groupDetail();

		},
		computed: {
			teacherLists() {
				if (this.teacher_lists) {
					return this.teacher_lists;
				} else {
					return [];
				}
			}
		},
		methods: {
			groupDetail() {
				let base_url = uni.getStorageSync('host');
				console.log(base_url);
				let _this = this;
				request({
					url: base_url + 'teacher/group/groupDetail',
					data: {
						subject_id: this.subjectId ? this.subjectId : 2
					},
					method: 'post',
					success(res) {
						if (res.statusCode == 200) {
							console.log(res.data.data);
							_this.school = res.data.data.school_district_info;
							_this.subject_name = res.data.data.name;
							_this.teacher_count = res.data.data.teacher_count;
							_this.teacher_lists = res.data.data.teacher_lists;
						} else {
							_this.$refs.uToast.show({
								title: res.data.message || '系统错误',
								type: 'warning',
							})
						}

					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.container {
		width: 100%;
		overflow: hidden;
		background: #F2F2F2;

		.list {
			width: 710rpx;
			background: #fff;
			border-radius: 12rpx;
			margin-top: 20rpx;
			margin-left: 20rpx;

			.campus {
				width: 100%;
				height: 60rpx;
				display: flex;
				justify-content: flex-start;

				text {
					font-size: 28rpx;
					margin-top: 30rpx;

					&:nth-child(1) {
						color: #666666;
						width: 150rpx;
						margin-left: 30rpx;
					}

					&:nth-child(2) {
						color: #333333;
					}
				}
			}

			.research_name {
				width: 100%;
				height: 60rpx;
				display: flex;
				justify-content: flex-start;

				text {
					font-size: 28rpx;
					margin-top: 30rpx;

					&:nth-child(1) {
						color: #666666;
						width: 150rpx;
						margin-left: 30rpx;
					}

					&:nth-child(2) {
						color: #333333;
					}
				}
			}

			.group_leader {
				width: 100%;
				height: 60rpx;
				display: flex;
				justify-content: flex-start;

				text {
					font-size: 28rpx;
					margin-top: 30rpx;

					&:nth-child(1) {
						color: #666666;
						text-indent: 1em;
						width: 150rpx;
						margin-left: 30rpx;
					}

					&:nth-child(2) {
						color: #333333;
					}

					&:nth-child(3) {
						margin-left: 25rpx;
						color: #333333;
					}

				}
			}

			.group_num {
				width: 100%;
				height: 60rpx;
				display: flex;
				justify-content: flex-start;

				text {
					font-size: 28rpx;
					margin-top: 30rpx;

					&:nth-child(1) {
						color: #666666;
						width: 150rpx;
						margin-left: 30rpx;
					}

					&:nth-child(2) {
						color: #333333;
					}
				}
			}
		}

		.teacher_list {
			width: 100%;
			margin-top: 20rpx;
			background: #fff;

			.teacher_info {
				width: 710rpx;
				height: 87rpx;
				display: flex;
				align-items: center;
				justify-content: flex-start;
				margin-left: 20rpx;
				border-bottom: 1rpx solid #F2F2F2;

				text {
					color: #666666;
					font-size: 26rpx;

					&:nth-child(1) {}

					&:nth-child(2) {
						margin-left: 32rpx;
					}

					&:nth-child(3) {
						margin-left: 80rpx;
					}

					&:nth-child(4) {
						margin-left: 110rpx;
					}

					&:nth-child(5) {
						margin-left: 75rpx;
					}

					&:nth-child(6) {
						margin-left: 75rpx;
					}
				}
			}

			.per_teacher {
				width: 710rpx;
				margin-left: 20rpx;
				overflow: hidden;

				view {
					width: 100%;
					border-bottom: 1rpx solid #F2F2F2;
					height: 80rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;

					.num {
						width: 60rpx;
						margin-left: 20rpx;
						color: #333333;
						font-size: 24rpx;
						height: 26rpx;
						line-height: 26rpx;
					}

					.name {
						width: 120rpx;
						color: #333333;
						font-size: 24rpx;
						height: 26rpx;
						line-height: 26rpx;
					}

					.phone {
						width: 195rpx;
						color: #333333;
						font-size: 24rpx;
						height: 26rpx;
						line-height: 26rpx;
					}

					.sex {
						width: 120rpx;
						height: 60rpx;
						display: flex;
						align-items: center;
						justify-content: flex-start;

						text {
							&:nth-child(1) {
								color: #333333;
								font-size: 24rpx;
							}
						}

						image {
							&:nth-child(2) {
								width: 30rpx;
								margin-left: 15rpx;
							}
						}
					}

					.grade {
						width: 150rpx;
						color: #333333;
						font-size: 24rpx;
						height: 26rpx;
						line-height: 26rpx;
					}

					.subject {
						width: 80rpx;
						color: #333333;
						font-size: 24rpx;
						height: 26rpx;
						line-height: 26rpx;
					}
				}
			}
		}

	}
</style>
